package controller;

import handlers.AvatarMvtHandler;
import handlers.MvtHandler;

import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.List;

import scheduler.Scheduler;

import map.Direction;
import entity.Entity;

public class EntityController extends Controller {
	
	private MvtHandler mHandler;
	
	public EntityController(Entity e) {
		mHandler = new AvatarMvtHandler(e);
	}

	@Override
	public List<GameControl> getKeyControls() {
		
		List<GameControl> controls = new ArrayList<GameControl>();
		
		
		// Move North
		controls.add(new GameControl(KeyEvent.VK_W, "MOVE_ENTITY_N", "Moves the Entity up") {

			@Override
			protected void execute() {
				
				
				mHandler.move(Direction.NORTH);		
			}
			
		});
		
		// Move South
		controls.add(new GameControl(KeyEvent.VK_X, "MOVE_ENTITY_S", "Moves the Entity north.") {

			@Override
			protected void execute() {
				mHandler.move(Direction.SOUTH);		
			}
			
		});
		
		// Move North-East
		controls.add(new GameControl(KeyEvent.VK_E, "MOVE_ENTITY_NE", "Moves the Entity south.") {

			@Override
			protected void execute() {
				mHandler.move(Direction.NORTHEAST);		
			}
			
		});
		
		// Move South-East
		controls.add(new GameControl(KeyEvent.VK_C, "MOVE_ENTITY_SE", "Moves the Entity south-east.") {

			@Override
			protected void execute() {
				mHandler.move(Direction.SOUTHEAST);		
			}
			
		});
		
		// Move North-West
		controls.add(new GameControl(KeyEvent.VK_Q, "MOVE_ENTITY_NW", "Moves the Entity north-west.") {

			@Override
			protected void execute() {
				mHandler.move(Direction.NORTHWEST);		
			}
			
		});
		
		// Move South-West
		controls.add(new GameControl(KeyEvent.VK_Z, "MOVE_ENTITY_SW", "Moves the Entity south-west.") {

			@Override
			protected void execute() {
				mHandler.move(Direction.SOUTHWEST);		
			}
			
		});
		
		
		// Return the controls
		return (controls);
	}
	
	@Override
	public void reset() {
		// TODO: reset the controls to not enabled
	}

}
